﻿using System;
using System.Collections.Generic;
using System.Data;
using System.IO;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ProjectSunny.Admin.Controls
{
    public partial class ViewProduct : System.Web.UI.UserControl
    {
        public string image;
        public string name;
        public string discription;
  
  
        public string summary;
        public string cate1_id;
        public string cate2_id;
        public string cate3_id;

        public string cate1_name;
        public string bigimage;
    
        public int idproduct;
        public string namecate1;
        public string namecate2;
        public string namecate3;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["idproduct"] != null)
            {
                idproduct = Convert.ToInt32(Request.QueryString["idproduct"]);
                DataTable dt = DAL.DCollector.DBCollector.Instance.StoredSelectTableWhereID("tbl_ThietKeWebsite","ThietKeWebsite_ID", idproduct.ToString());
                cate1_id = dt.Rows[0]["Category_ID1"].ToString();
                cate2_id = dt.Rows[0]["Category_ID2"].ToString();
                cate3_id = dt.Rows[0]["Category_ID3"].ToString();
            
                image = dt.Rows[0]["ThietKeWebsite_Image"].ToString();
               
                name = dt.Rows[0]["ThietKeWebsite_Name"].ToString();
                discription = dt.Rows[0]["ThietKeWebsite_Description"].ToString();
          
                summary = dt.Rows[0]["ThietKeWebsite_Summary"].ToString();

                dt = DAL.DCollector.DBCollector.Instance.StoredSelectTableWhereID("tbl_Category","Category_ID1", cate1_id.ToString());
                namecate1 = dt.Rows[0]["Category_Name"].ToString();
                dt = DAL.DCollector.DBCollector.Instance.StoredSelectTableWhereID("tbl_Category","Category_ID1", cate2_id.ToString());
                namecate2 = dt.Rows[0]["Category_Name"].ToString();
                dt = DAL.DCollector.DBCollector.Instance.StoredSelectTableWhereID("tbl_Category","Category_ID1", cate3_id.ToString());
                namecate3 = dt.Rows[0]["Category_Name"].ToString();
              
    




        
            }
        }

        protected void lbtDelete_Click(object sender, EventArgs e)
        {
            int productid = Convert.ToInt32(Request.QueryString["idproduct"]);
            DAL.DCollector.DBCollector.Instance.StoredDelete("tbl_ThietKeWebsite", "ThietKeWebsite_ID", productid.ToString());
            Response.Redirect("/Admin/Index.aspx?panel=1&sub=1");
        }
    }
}